import Vue from 'vue'
// 导入路由插件
import Router from 'vue-router'
// 导入上面定义的组件
import Login from '../components/Login'
import Register from '../components/Register';
import Main from '../components/Main'
import OperatingSheet from "../components/OperatingSheet";
import Description from "../components/Description";
import Shell from "../components/Shell"
//引入子路由
import UserManagement from "./UserManagement";
import ManagerManagement from "./ManagerManagement";

// 安装路由
Vue.use(Router); // 配置路由

//注意:'/'开头的路由都会被视为根路由

//配置路由
export default new Router({
  base: '/dist',
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: Login,
      meta: {
        keepAlive: false  //表示是否显示公共导航栏
      }
    },
    {
      path: '/register',
      name: 'register',
      component: Register,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/main',  //小写
      name: 'main',  //小驼峰
      component: Main,  //大驼峰
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/operatingsheet',
      name: 'operatingSheet',
      component: OperatingSheet,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/description',
      name: 'description',
      component: Description,
      meta: {
        keepAlive: false
      },
    },
    {
      path: '/shell',
      name: 'shell',
      component: Shell,
      meta: {
        isShell: true
      },
    },
    //重定向路由
    {
      path: '/usermanagement',
      redirect: '/usermanagement/information'
    },
    {
      path: '/managermanagement',
      redirect: '/managermanagement/information'
    },
    //引入子路由
    UserManagement,
    ManagerManagement
  ]
});
